-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add xmltype in postgres #1112
base: master
Are you sure you want to change the base?
add xmltype in postgres #1112
Conversation
@mauravan you can look at the existing tests of other PG specific data type and add tests in their location |
I'm curious, did you try using a string ? |
that's why im looking for an integration test - i suspect we might be able to use a String as long as we pass it as UTF8. Then we could just remove the wrapper class. i did not have a lot of time to look into it, but i will have some time soon and will dig a bit deeper |
fd24b1a
to
228cc41
Compare
Signed-off-by: Meier Roman <[email protected]>
228cc41
to
37a791e
Compare
Hi @vietj, So turns out we might as well use String. Or do you think there is value in an extra class like the PgSQLXML i added? otherwise i will happily remove it. Also what needs to happen next to get this merged? Thanks for your help, EDIT: I just tried this with quarkus and i think it's really unhandy to have to use an extra class for this when we could be using String - will change this EDIT2: So i did it using String now and it works just fine i think - one problem i encountered was the mapping in the DataType.java because there is already a mapping for String to Varchar
Which seems to be only important in case of a PrepareStatementCommand with parameterTypes which the test i'm executing are apparently not using. Maybe you have some more insight into that? |
Signed-off-by: Roman Meier <[email protected]>
this needs to be reviewed to be merged |
@@ -229,5 +220,8 @@ static DataType lookup(Class<?> type) { | |||
encodingTypeToDataType.put(Polygon[].class, POLYGON_ARRAY); | |||
encodingTypeToDataType.put(Circle.class, CIRCLE); | |||
encodingTypeToDataType.put(Circle[].class, CIRCLE_ARRAY); | |||
|
|||
// encodingTypeToDataType.put(String.class, XML); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this commented ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the Comment from the 22. of Dec:
So i did it using String now and it works just fine i think - one problem i encountered was the mapping in the DataType.java because there is already a mapping for String to Varchar
encodingTypeToDataType.put(String.class, VARCHAR); encodingTypeToDataType.put(String[].class, VARCHAR_ARRAY); encodingTypeToDataType.put(String.class, XML); encodingTypeToDataType.put(String[].class, XML_ARRAY);
Which seems to be only important in case of a PrepareStatementCommand with parameterTypes which the test i'm executing are apparently not using. Maybe you have some more insight into that?
this PR changes a lot of things that should not be changed (like reformatting), can you keep only to the essential changes ? |
Signed-off-by: Roman Meier <[email protected]>
Signed-off-by: Roman Meier <[email protected]>
Hi @vietj, thanks for the feedback - i reverted all the changes. The one big Problem with the One solution i could think of is to use a wrapper class for XML which would then just hold the String. Do you have any other ideas? |
why is it an issue ? |
There is these 2 cases for the Map:
Where for the valueOf Method we have a mapping for each oid for the lookup i think there can only be a mapping per type. So either the Mapping is
Or it is |
@@ -186,8 +186,11 @@ static DataType lookup(Class<?> type) { | |||
for (DataType dataType : values()) { | |||
oidToDataType.put(dataType.id, dataType); | |||
} | |||
encodingTypeToDataType.put(String.class, VARCHAR); | |||
encodingTypeToDataType.put(String[].class, VARCHAR_ARRAY); | |||
// encodingTypeToDataType.put(String.class, VARCHAR); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this commented ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I understand it, there can only be one mapping per class to a Type. This is the Problem i was talking about in the other comments which we need to solve here - so either there will be a need for a wrapper class or someone can come up with a better solution for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are totally right, this is because we cannot specify which database type to use in a tuple for a given java type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So there will be something like a new Class like PgXMLType
which just holds a String. Would you agree to that?
Motivation:
see #1111
I'm looking for a little guidance on this.
thanks
R